/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package br.com.documentar.controller;

import br.com.documentar.interfacee.InterfaceController;
import br.com.documentar.model.AssociarClienteVersaoModel;
import java.util.List;
import javax.swing.DefaultComboBoxModel;
import javax.swing.table.DefaultTableModel;

/**
 *
 * @author Santos
 */
public class AssociarClienteVersaoController implements InterfaceController<AssociarClienteVersaoModel> {

    private final br.com.documentar.DAO.AssociarClienteVersaoDAO dao = new br.com.documentar.DAO.AssociarClienteVersaoDAO();

    @Override
    public AssociarClienteVersaoModel getModel() {
        return new AssociarClienteVersaoModel();
    }

    @Override
    public DefaultTableModel insertTableModel(AssociarClienteVersaoModel model) {
        model.getModelTable().setNumRows(0);
        for (br.com.documentar.model.AssociarClienteVersaoModel p : dao.getDados(model)) {
            //    model.getModelTable().addRow(new Object[]{p.getCodigo(), p.getNome(), p.getAtivo()});
        }
        return model.getModelTable();
    }

    @Override
    public DefaultTableModel getDadosTableModel(AssociarClienteVersaoModel model) {
        return insertTableModel(model);
    }

    @Override
    public boolean setDados(AssociarClienteVersaoModel model) {
        return dao.setDados(model);
    }

    @Override
    public DefaultComboBoxModel getDadosComboBoxModel(AssociarClienteVersaoModel model) {
        return insertComboBoxModel(model);
    }

    @Override
    public DefaultComboBoxModel insertComboBoxModel(AssociarClienteVersaoModel model) {
        model.getModelComboBox().setSelectedItem("ESCOLHER");
        for (br.com.documentar.model.AssociarClienteVersaoModel p : dao.getDados(model)) {
            //model.getModelComboBox().addElement(p.getCodigo() + " - " + p.getNome());
        }
        return model.getModelComboBox();
    }

    public List<AssociarClienteVersaoModel> getDadosOracle(AssociarClienteVersaoModel model) {
        return dao.getDadosERP(model);
    }

    public List<AssociarClienteVersaoModel> getDados(AssociarClienteVersaoModel model) {
        return dao.getDados(model);
    }

    public List<AssociarClienteVersaoModel> getDadosFrenteLoja(AssociarClienteVersaoModel model) {
        return dao.getDadosFrenteLoja(model);
    }
}
